/*
 * @ClassName login_model.dart
 * @Description 登录模型
 * @Author SuPeiSen
 * @Date 2020/7/17 15:05
 */

import 'package:flutter_su/model/base_model.dart';
import 'package:json_annotation/json_annotation.dart';

part 'login_model.g.dart';


@JsonSerializable()
class LoginModel with BaseModel {

  @JsonKey(name: 'data')
  Data data;

  @JsonKey(name: 'resultCode')
  int resultCode;

  @JsonKey(name: 'resultDesc')
  String resultDesc;

  LoginModel([this.data,this.resultCode,this.resultDesc,]);

  factory LoginModel.fromJson(Map<String, dynamic> srcJson) => _$LoginModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$LoginModelToJson(this);

  @override
  T toModel<T>(Map<String, dynamic> srcJson) {
    return LoginModel.fromJson(srcJson) as T;
  }

}


@JsonSerializable()
class Data extends Object {

  @JsonKey(name: 'isAuth')
  int isAuth;

  @JsonKey(name: 'X_Token')
  String xToken;

  @JsonKey(name: 'userType')
  int userType;

  Data(this.isAuth,this.xToken,this.userType,);

  factory Data.fromJson(Map<String, dynamic> srcJson) => _$DataFromJson(srcJson);

  Map<String, dynamic> toJson() => _$DataToJson(this);

}


